package webui;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Servlet
 */
public class Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.processRequest(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.processRequest(request, response);
	}
	
	// METODI DI AZIONE
	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		// valutazione se calcolare area o perimetro
		String parametroSceltaMode = request.getParameter("btnMode");
		
		if (parametroSceltaMode.equalsIgnoreCase("Update")) {
			request.setAttribute("localMode", "Hai deciso di aggiornare gli standard!");
		}
		
		
		else if (parametroSceltaMode.equalsIgnoreCase("Check")) {
			request.setAttribute("localMode", "Hai deciso di verificare il valore attuale sensori");

			
			
			
		} //end if
		
		request.getRequestDispatcher("ControlPanel.jsp").forward(request, response);
		}
		
		


} //end class
